//
//  DemoTransitionViewController.m
//  HDTransitonDemo
//
//  Created by mac on 2017/5/19.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "DemoTransitionViewController.h"
#import "DemoCATransitionPresentedViewController.h"
#import "DemoCATransitionPushedViewController.h"
#import "UINavigationController+LiDaPush.h"
@interface DemoTransitionViewController ()

@end

@implementation DemoTransitionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.view.bounds];
    imageView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"01" ofType:@"jpg"]];
    [self.view addSubview:imageView];
    
    [self addBtns];

}

- (void)addBtns{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 100, self.view.frame.size.width, 50)];
    [btn setTitle:@"Push" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(actionButton1:) forControlEvents:UIControlEventTouchUpInside];
    btn.layer.borderColor = [UIColor redColor].CGColor;
    btn.layer.borderWidth = 2.0f;
    [self.view addSubview:btn];
    
    UIButton *btn2 = [[UIButton alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 220, self.view.frame.size.width, 50)];
    [btn2 setTitle:@"present" forState:UIControlStateNormal];
    [btn2 setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [btn2 setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [btn2 addTarget:self action:@selector(actionButton2:) forControlEvents:UIControlEventTouchUpInside];
    btn2.layer.borderColor = [UIColor redColor].CGColor;
    btn2.layer.borderWidth = 2.0f;
    [self.view addSubview:btn2];
}

- (void)actionButton2:(UIButton *)sender{
    DemoCATransitionPresentedViewController *presentedVC = [[DemoCATransitionPresentedViewController alloc] init];
    presentedVC.demoType = _demoType;
    
    switch (_demoType) {
            // 常见四种
        case DemoCATransitionTypeFade:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:kCATransitionFade WithSubtype:nil];
            break;
        case DemoCATransitionTypePush:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:kCATransitionPush WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeMoveIn:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:kCATransitionMoveIn WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeReveal:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:kCATransitionReveal WithSubtype:kCATransitionFromRight];
            break;
            
        case DemoCATransitionTypeCube:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"cube" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeOglFlip:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"oglFlip" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeSuckEffect:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"suckEffect" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeRippleEffect:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"rippleEffect" WithSubtype:nil];
            break;
        case DemoCATransitionTypePageCurl:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"pageCurl" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypePageUnCurl:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"pageUnCurl" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeCameraIrisHollowOpen:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"cameraIrisHollowOpen" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeCameraIrisHollowClose:
            [self.navigationController LiDa_PresentViewControlle:presentedVC WithAnimationType:@"cameraIrisHollowClose" WithSubtype:nil];
            break;
        default:
            break;
    }

}
- (void)actionButton1:(UIButton *)sender {
    DemoCATransitionPresentedViewController *presentedVC = [[DemoCATransitionPresentedViewController alloc] init];
    presentedVC.demoType = _demoType;
    
    switch (_demoType) {
            // 常见四种
        case DemoCATransitionTypeFade:
//            animation.type = kCATransitionFade;
            [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:kCATransitionFade WithSubtype:nil];
            break;
        case DemoCATransitionTypePush:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:kCATransitionPush WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeMoveIn:
            [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:kCATransitionMoveIn WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeReveal:
            [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:kCATransitionReveal WithSubtype:kCATransitionFromRight];
            break;
            
        case DemoCATransitionTypeCube:
            [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"cube" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeOglFlip:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"oglFlip" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeSuckEffect:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"suckEffect" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeRippleEffect:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"rippleEffect" WithSubtype:nil];
            break;
        case DemoCATransitionTypePageCurl:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"pageCurl" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypePageUnCurl:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"pageUnCurl" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeCameraIrisHollowOpen:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"cameraIrisHollowOpen" WithSubtype:kCATransitionFromRight];
            break;
        case DemoCATransitionTypeCameraIrisHollowClose:
             [self.navigationController LiDa_PushViewControlle:presentedVC WithAnimationType:@"cameraIrisHollowClose" WithSubtype:nil];
            break;
        default:
            break;
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
